require.config({
	paths : {
		"jquery" : "../jquery",
		"cookie" : "../jquery.cookie",
		"common" : "../common",
		"shopcookie" : "../shopcookie"
	}
})
require(["jquery","cookie","common","shopcookie"],function($,cookie,common,shopcookie){
	common.fn();
	shopcookie.fn();
	$("#list ul li").hover(function(){
		$(this).children("a").css("color","#008842");
		$(this).children("a").stop().animate({"padding-left":"14"},300);
	},function(){
		$(this).children("a").css("color","#000");
		$(this).children("a").stop().animate({"padding-left":"7"},300);
		return false;
	})
	$(".smallpic").hover(function(){
		$("#pic").html($(this).html());
		$(".smallpic").removeClass("borderGreen");
		$(this).addClass("borderGreen");
	})
	$("#content #img #chose span").click(function(){
		$("#content #img #chose span").removeClass("show");
		$(this).addClass("show");
	})
	$($("#information #addshop #num i")[0]).click(function(){
		$("#information #addshop #num input").val(~~($("#information #addshop #num input").val()) + 1);
	})
	$($("#information #addshop #num i")[1]).click(function(){
		if($("#information #addshop #num input").val() > 1){
			$("#information #addshop #num input").val(~~($("#information #addshop #num input").val()) - 1);
		}else{
			$("#information #addshop #num input").val(1);
		}
	})
	$("#information #addshop #shopcar").click(function(){
		if(!(/^\d+$/.test($("#information #addshop #num input").val()))){
			$("#information #addshop #num input").val(1);
		}
		if($.cookie("product1")){
			var oCook = JSON.parse($.cookie("product1"));
			$.cookie("product1",'{"id":"1","num":' + (oCook.num + ~~$("#information #addshop #num input").val()) + ',"price":"¥20.90","infor":"秘鲁红提500g","img":"../img/list_content (24).jpg"}',{ expires: 7, path: '/' } );
		}else{
			$.cookie("product1",'{"id":"1","num":1,"price":"¥20.90","infor":"秘鲁红提500g","img":"../img/list_content (24).jpg"}',{ expires: 7, path: '/' } );
		}
		var $img = $("#content #pic img").clone().appendTo($("#content #pic"));
		$img.css("position","relative");
		$img.animate({"height":"30","width":"30","top":"-610","left":"1120"},1000,function(){
			$img.remove();
		});
		shopcookie.fn();
	})
})
